﻿'极限检测记录表
Public Class clsJxjcInfo
    Public Function insert(en As entity_jxjcInfo) As Integer
        Dim sql As String = String.Empty
        Dim rtn As Integer

        sql &= "INSERT INTO sf.b_prod_jxjc_info( factory_id , prod_id , project_name , "
        sql &= "support_model , check_date , design_displacement , measured_displacement , maximum_force , shear_strain , "
        sql &= "note , operator , update_time) "
        sql &= "VALUES ( ?, ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , (SELECT CURRENT_TIMESTAMP(6)))"
        With en
            rtn = DBacs.ExecuteUpdateSql(sql, -1, .factory_id, .prod_id, .project_name,
                                         .support_model, .check_date, .design_displacement, .measured_displacement, .maximum_force, .shear_strain,
                                         .note, .Ope)
        End With
        Return rtn
    End Function

    Public Function update(en As entity_jxjcInfo) As Integer
        Dim sql As String = String.Empty
        Dim rtn As Integer

        sql &= " UPDATE sf.b_prod_jxjc_info  "
        sql &= " SET prod_id = ? "
        sql &= ", project_name = ? "
        sql &= ", support_model = ? "
        sql &= ", check_date = ? "
        sql &= ", design_displacement = ? "
        sql &= ", measured_displacement = ? "
        sql &= ", maximum_force = ? "
        sql &= ", shear_strain = ? "
        sql &= ", note = ? "
        sql &= ", operator = ? "
        sql &= ", update_time = (SELECT CURRENT_TIMESTAMP(6)) "
        sql &= " WHERE "
        sql &= " sys_id = ? "
        With en
            rtn = DBacs.ExecuteUpdateSql(sql, -1, .prod_id, .project_name,
                                         .support_model, .check_date, .design_displacement, .measured_displacement, .maximum_force, .shear_strain,
                                         .note, .Ope, .sys_id)
        End With
        Return rtn
    End Function


    Public Function selectBySysid(_sysid As String) As DataTable
        Dim szSql As String = ""
        szSql &= "select * from sf.b_prod_jxjc_info where factory_id=? and sys_id=?"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, g_factory_id, _sysid)
        If IsNothing(dt) Then
            selectBySysid = New DataTable
        Else
            selectBySysid = dt
        End If

    End Function

    Public Function selectAll(Optional prod_id As String = "",
                              Optional project_name As String = "",
                              Optional support_model As String = "", Optional check_date As String = "") As DataTable
        Dim szSql As String = ""
        szSql &= "select * from sf.b_prod_jxjc_info where factory_id=? "
        If prod_id <> "" Then
            szSql &= " and prod_id like ('%" & prod_id & "%')"
        End If
        If project_name <> "" Then
            szSql &= " and project_name like ('%" & project_name & "%')"
        End If
        If support_model <> "全部" Then
            szSql &= " and support_model like ('%" & support_model & "%')"
        End If
        If check_date <> "" Then
            szSql &= " and check_date > '" & check_date & "'"

        End If
        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, g_factory_id)
        If IsNothing(dt) Then
            selectAll = New DataTable
        Else
            selectAll = dt
        End If

    End Function
End Class
